package com.maimao.goods.client;

import com.maimao.core.constant.ServiceContainer;
import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.core.model.resp.Result;
import com.maimao.goods.client.factory.CouponFallBackFactory;
import com.maimao.goods.client.factory.ShopFallBackFactory;
import com.maimao.model.info.Coupon;
import com.maimao.model.info.input.ConfirmCoupon;
import com.maimao.model.order.confirm.CouponSimple;
import com.maimao.model.user.Shop;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * @author MaoLin Wang
 * @date 2020/12/22 7:54 下午
 */
@RequestMapping("/info/coupon")
@FeignClient(contextId = "couponClient", value = ServiceContainer.INFO_SERVICE, fallbackFactory = CouponFallBackFactory.class, configuration = FeignInterceptor.class)
public interface CouponClient {

    @PostMapping("/client/couponUserExit")
    Result<Map<Long, Boolean>> couponUserExist(@RequestBody List<Long> couponIds, @RequestParam("userId") Long userId);

    @PostMapping("/shop-coupon/take-query")
    Result<List<CouponSimple>> takeAndQueryUsefulShopCoupon(@RequestBody ConfirmCoupon confirmCoupon);

    @PostMapping("/sys-coupon/take-query")
    Result<List<CouponSimple>> takeAndQuerySysUsefulShopCoupon(@RequestBody ConfirmCoupon confirmCoupon);
}
